package 蒙特卡洛;

/**
 * @ClassName: testshape2
 * @Auther: Drawin
 * @Date: 2021/10/12 22:15
 * @Description:
 */

public class testshape2 {
    public double sumShape(Shape[] shapes){
        double sum=0;
        for(int i=0;i<shapes.length;i++)
            sum+=shapes[i].getArea();
        return sum;
    }

    public static void main(String[] args) {
        Shape[] s=new Shape[5];
        s[0]=new Circle(3);
        s[1]=new Circle(4);
        s[2]=new Rectangle(4,3);
        s[3]=new Rectangle(5,4);
        s[4]=new MonteCarlo(3);
        testshape2 ts=new testshape2();
        System.out.println("sumshape="+ts.sumShape(s));
    }//失败了，蒙特卡洛还是没加进去
}
